import { type Plugin } from 'vue'

export default {
  install: () => {
    Number.prototype.toCustomFixed = function (decimal?: number) {
      if (!decimal && decimal !== 0) return String(this)
      return (Math.round(Number(+this + 'e' + decimal) * 1) / Math.pow(10, decimal)).toFixed(
        decimal
      )
    }
  }
} as Plugin
